/**
 * @description: 校验网络请求状态码
 * @param {Number} status
 * @return void
 */
export const checkStatus = (status: number) => {
  const globalStore = useGlobalStore();
  globalStore.modalLoading = false;
  globalStore.loading = false;
  switch (status) {
    case 400:
      globalStore.setMessage("请求失败！请您稍后重试", "error");
      break;
    case 404:
      globalStore.setMessage("你所访问的资源不存在！", "error");
      break;
    case 405:
      globalStore.setMessage("请求方式错误！请您稍后重试", "error");
      break;
    case 408:
      globalStore.setMessage("请求超时！请您稍后重试", "error");
      break;
    case 500:
      globalStore.setMessage("服务异常！", "error");
      break;
    case 502:
      globalStore.setMessage("网关错误！", "error");
      break;
    case 503:
      globalStore.setMessage("服务不可用！", "error");
      break;
    case 504:
      globalStore.setMessage("网关超时！", "error");
      break;
    default:
      globalStore.setMessage("请求失败！", "error");
  }
};
